﻿
@{
    ViewBag.Title = "系统公告";
    Layout = "~/Views/Shared/_MallLayout.cshtml";
    int type = 1;
    if (Request["type"] != null && !string.IsNullOrEmpty(Request["type"].ToString())) {
        type = int.Parse(Request["type"].ToString());
    }
}
<body class="page-notice">
    @Html.Partial("_PMallHead")
    <div class="tipList " >
        <div class="mescroll" id="mescroll">
            <ul id="dataList"></ul>
        </div>
    </div>
</body>
@section scripts{
    <link href="~/Scripts/mescroll/mescroll.min.css" rel="stylesheet" />
    <script src="~/Scripts/mescroll/mescroll.min.js"></script>
    <script>
        $(function () {
          
            var mescroll = new MeScroll("mescroll", {
                down: {
                    auto: false,
                    callback: function (mescroll) {
                        mescroll.resetUpScroll(); //下拉刷新的回调,默认重置上拉加载列表为第一页
                    },
                },
                up: {
                    callback: getListData,
                    clearEmptyId: "dataList",
                    isBounce: false,
                    noMoreSize: 3,
                    htmlNodata: '<p class="upwarp-nodata">--没有更多数据了 --</p >',
                    empty: {
                        warpId: "dataList",
                        icon: "",
                        tip: "亲,没有您要找的公告~",

                    },
                    toTop: {
                        //src: "/content/c2c/img/toup.png",
                        //html: "<p>^<br/>顶部<p>",
                        //offset: 500
                    }
                }
            });
            function getListData(page) {
                $.ajax({
                    type: 'post',
                    url: '/Notic/_List',
                    data: { page: page.num, size: page.size, type:'@type' },
                    success: function (response) {
                        var paged = $(response).siblings("page");
                        var rows = Number.parseInt(paged.attr("rows"));
                        var total = Number.parseInt(paged.attr("total_result"));
                        mescroll.endBySize(rows, total);
                        if (paged.length == 1) {

                            $("#dataList").append($(response));
                            $('#dataList page').remove();
                        }

                    },
                    error: function (e) {
                        //联网失败的回调,隐藏下拉刷新和上拉加载的状态
                        mescroll.endErr();
                    }
                });
            }
        })
    </script>
   
}